import java.sql.Date;
import java.util.ArrayList;



public class Login {
	private String username = "";
	private String password = "";

	public Login(String username, String password)
	{
		this.username = username;
		this.password = password;
	}
	/*
	public static void main (String[] args) throws Exception
	{
		MyQuery query = new MyQuery();
		ArrayList<User> newUser = query.searchUserByName("John");
		User user = newUser.get(0);
		user.setPassword("upsword");
		System.out.println(user.getPassword());
		query.updateUser(user,user.getSSN());
	}
	*/

	/**
	 * Checks to to see if the user has entered in the correct login information from the login screen
	 * LOGIN GUI must only allow passage if user if user is returned.
	 * If a null is return, GUI must ask for user to re-enter password.
	 * @return user
	 */
	public User authenticate()
	{
		MyQuery query = new MyQuery();
		User user;
		try {
			user = query.authenticateUser(username, password);
			System.out.println("Login Passed");
			return user;
		} 
		
		catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println("Exception Error at");
			return null;
		}
		
	}
}


